package cn.iocoder.yudao.module.course.content.dal.mysql.coursecontent;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.course.content.dal.dataobject.coursecontent.CourseContentDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.course.content.controller.admin.coursecontent.vo.*;

/**
 * 课时内容管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface CourseContentMapper extends BaseMapperX<CourseContentDO> {

    default PageResult<CourseContentDO> selectPage(CourseContentPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CourseContentDO>()
                .eqIfPresent(CourseContentDO::getCourseCode, reqVO.getCourseCode())
                .eqIfPresent(CourseContentDO::getResCode, reqVO.getResCode())
                .betweenIfPresent(CourseContentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CourseContentDO::getId));
    }

    default List<CourseContentDO> selectList(CourseContentExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CourseContentDO>()
                .eqIfPresent(CourseContentDO::getCourseCode, reqVO.getCourseCode())
                .eqIfPresent(CourseContentDO::getResCode, reqVO.getResCode())
                .betweenIfPresent(CourseContentDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CourseContentDO::getId));
    }

}
